Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "none" item spawning from reloading a loaded smoking rack #38477

Merged
merged 1 commit into from
Mar 1, 2020

Conversation

jkraybill
Copy link
Contributor

Summary

SUMMARY: Bugfixes "Fix 'none' item spawning from reloading a loaded smoking rack"

Purpose of change

Fixes #38462. Loading charcoal into a smoking rack with charcoal and smokeable items already in it, and then answering "Y" to unload the charcoal, was leading to a bug where you got an item called "none" in your inventory.

Describe the solution

The error was happening because the call to only_item() was assuming there would only be one item in the smoker's item stack.

So I changed it to look through the stack until it finds the smoker's ammo, and then picking that up.

Describe alternatives you've considered

Doing nothing. This is an easy one to work around by not doing the Unload as part of that dialogue.

Testing

Spawned smoking racks before and after, loaded with fruit and charcoal, and reloading them. Afterwards there was no error and the item quantities stayed in balance.

Additional context

Still being new to the codebase, if there's a cleaner way of just saying "pick up the ammo item out of this stack", let me know!

As an aside, smoking rack load/unload behaviour in general is a little inconsistent with how, say, charcoal smokers work, which is annoying, but tackling that is a much bigger task.

@Rivet-the-Zombie Rivet-the-Zombie merged commit e035f12 into CleverRaven:master Mar 1, 2020
@jkraybill jkraybill deleted the 38462 branch March 1, 2020 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"none" item, unknown cause; possibly smoking rack
2 participants